package com.visionforge.sdk;

import java.util.HashMap;
import java.util.Map;

/**
 * 模型类型枚举，对应Python SDK中的_detect_static_enum_dict
 */
public enum ModelType {
    FIRE("001fire", "001火灾检测"),
    GARBAGE("002garbage", "002垃圾检测"),
    FACE_DETECT("003faceDetect", "003人脸检测"),
    CALL_PHONE("004callPhone", "004打电话识别"),
    FIGHTING("005fight", "005人员打架"),
    SAFE_HAT("006safeHat", "006安全帽识别"),
    SMOKE("007smoke", "007吸烟识别"),
    WALKER_MAN("008walkerMan", "008行人识别"),
    MASK_DETECT("009maskDetect", "009口罩检测"),
    FALL_DETECT("010fallDetect", "010人员跌倒识别"),
    CROSS_FENCE_DETECT("011crossFenceDetect", "011翻越围栏识别"),
    STREET_VENDOR_DETECT("012streetVendorDetect", "012街头流动商贩识别");

    private final String code;
    private final String description;
    private static final Map<String, ModelType> CODE_MAP = new HashMap<>();

    static {
        for (ModelType type : values()) {
            CODE_MAP.put(type.code, type);
        }
    }

    ModelType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    /**
     * 根据模型编码获取模型类型枚举
     * @param code 模型编码
     * @return 模型类型枚举，如果未找到返回null
     */
    public static ModelType fromCode(String code) {
        return CODE_MAP.get(code);
    }
}